#ifndef CALC
#define CALC

#include <string>
#include <cctype>
#include <sstream>
#include <iostream>
#include <map>

using namespace std;

#include "BaseModule.h"

enum Token_value
{
                NAME,           NUMBER,         END,
                PLUS='+',       MINUS='-',      MUL='*',        DIV='/',
                PRINT=';',      ASSIGN='=',     LP='(',         RP=')'
};

class Calc : public BaseModule
{
        public:
                Calc(string str);
                virtual ~Calc(){}
                
                virtual string showAnswer();
				

        private:        
                int no_of_errors, index;
                string string_value, error_code;
                Token_value curr_tok;
                double number_value, answer;
                map <string,double> table;

                double error(const char* s);
                Token_value get_token();
                double expr(bool get);
                double prim(bool get);
                double term(bool get);
};

extern "C" BaseModule* create(string str);

extern "C" void destroy(BaseModule* mod);

extern "C" BaseModule* ccreate();

#endif
